package com.alibaba.dubbo.examples.generic;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.alibaba.dubbo.examples.generic.api.IUserService;
import com.alibaba.dubbo.examples.generic.api.IUserService.Params;
import com.alibaba.dubbo.examples.generic.api.IUserService.User;

/**
 * GenericConsumer
 *
 * @author chao.liuc
 */
public class GenericConsumer {

    private static Logger logger = LoggerFactory.getLogger(GenericConsumer.class);

    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("generic/generic-consumer.xml");
        IUserService userservice = (IUserService) context.getBean("userservice");
//        while (true) {
        try {
//            Thread.sleep(3000);
            User user = userservice.get(new Params("a=b"));
            logger.info(user.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
//        }
    }
}
